<template>
  <div id="login">
    <div class="login_wrap">
      <div class="back_box">
        <router-link to="/login">
          <img
            class="back_img"
            src="../../../static/images/tabbar/back.png"
            alt=""
          />
        </router-link>
      </div>
      <div class="logo_box">
        <div>
          <img
            class="logo"
            src="../../../static/images/login&regisetr/login01.png"
            alt=""
          />
          <p>绑定手机登录更安全</p>
        </div>
      </div>
      <div class="login_from_wrap">
        <van-form @submit="onSubmit">
          <van-field
            class="textinput"
            v-model="username"
            name="uname"
            label="用户名"
            placeholder="用户名"
            :rules="[{ required: true, message: '请填写用户名' }]"
          />
          <van-field
            class="textinput"
            v-model="password"
            type="password"
            name="pwd"
            label="密码"
            placeholder="密码"
            :rules="[{ required: true, message: '请填写密码' }]"
          />
          <div style="margin: 16px">
            <van-button
              class="submit"
              round
              block
              type="info"
              native-type="submit"
              >注册</van-button
            >
            <slot name="verificationbtn"></slot>
          </div>
        </van-form>
      </div>
    </div>
  </div>
</template>

<script>
import fromitem from "./fromitem";
import { Toast } from 'vant';


export default {
  props: ["logintitle"],
  components: {
    fromitem,
  },
  data() {
    return {
      username: "",
      password: "",
    };
  },
  methods: {
    onSubmit(values) {
      console.log("submit", values);
      // console.log(222);
      sessionStorage.setItem("uname", JSON.stringify(values) );
     
      Toast.success('注册成功');
      this.$router.push('/login');
    },
  },
};
</script>

<style lang="less" scoped>
#login {
  display: flex;
  justify-content: center;
  background-color: white;
  height: 1290px;
  .login_wrap {
    width: 670px;
    .back_box {
      text-align: left;
      height: 88px;
      display: flex;
      align-items: center;
      img {
        height: 46px;
        width: 42px;
      }
    }
    .logo_box {
      height: 288px;
      display: flex;
      align-items: center;
      justify-content: center;
      div {
        img {
          height: 180px;
          width: 180px;
        }
        p {
          font-size: 24px;
          color: #999999;
          margin-top: 20px;
        }
      }
    }

    .wenzi {
      font-size: 24px;
      margin-top: 40px;
      display: flex;
      justify-content: space-between;
      a {
        color: #333333;
      }
    }
    .zi {
      margin-top: 112px;
      p {
        font-size: 20px;
        color: #999999;
      }
    }
  }
}
.submit {
  background-color: #fb2c48;
  height: 79px;
  border-radius: 0;
  border: none;
  margin-top: 122px;
}
.verification_code {
  background-color: #cccccc;
  height: 79px;
  border-radius: 0;
  border: none;
  margin-top: 40px;
  color: #333333;
}
</style>